<template>
  <div class="details" v-if="detail.id">
    <div class="top">
      <img src="../../assets/images/qr.png" alt="" @click="goback" />
      <p>{{ $t("common.chongzhixiang") }}</p>
    </div>
    <div class="content">
      <div class="div1">
        <p>{{ $t("common.shuliang") }}</p>
      </div>
      <div class="div2">
        <p>{{ detail.quantity || 0 }}<span>USDT</span></p>
      </div>
      <div class="div3">
        <p>
          <img src="../../assets/images/xq.png" alt="" />{{
            filterState(detail.state)
          }}
        </p>
      </div>
      <div class="div4">
        <p>{{ $t("common.chakanxiang") }}</p>
      </div>
    </div>
    <div class="bottom">
      <div class="bottoma">
        <p class="p1">{{ $t("common.querenshu") }}</p>
        <p class="p2">{{ detail.blockConfirmationRechargeNumber }}</p>
      </div>
      <div class="bottoma">
        <p class="p1">{{ $t("common.chongzhizhang") }}</p>
        <p class="p2">{{ $t("common.zijinzhanghu") }}</p>
      </div>
      <div class="bottoma" v-show="detail.publicChain">
        <p class="p1">{{ $t("common.zhuanzhangwang") }}</p>
        <p class="p2">{{ detail.publicChain == "1" ? "Ethereum" : "Tron" }}</p>
      </div>
      <div class="bottomb" v-show="detail.arrivalAddress">
        <p class="p1">{{ $t("common.dizhi") }}</p>
        <p class="p2">{{ detail.arrivalAddress }}</p>
        <img
          src="../../assets/images/xq2.png"
          alt=""
          @click="copyLink(detail.arrivalAddress)"
        />
      </div>
      <div class="bottomc" v-show="detail.transactionHash">
        <p class="p1">{{ $t("common.jiaoyi") }}</p>
        <p
          class="p2"
          style="text-decoration: underline"
          @click="toHashUrl(detail.transactionHash)"
        >
          {{ detail.transactionHash }}
        </p>
        <img
          src="../../assets/images/xq2.png"
          alt=""
          @click="copyLink(detail.transactionHash)"
        />
      </div>
      <div class="bottoma">
        <p class="p1">{{ $t("common.riqi") }}</p>
        <p class="p2">{{ detail.createTime }}</p>
      </div>
      <div class="bottoma">
        <p class="p1">{{this.$t("common.leixing")}}</p>
        <p class="p2">{{
            filterType(detail.type)
          }}</p>
      </div>
      <div class="bottoma" v-show="detail.remark">
        <p class="p1">{{this.$t("long.beizhu")}}</p>
        <p class="p2">{{ detail.remark }}</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      zid: '',
      detail: {},
      typeList: [],
      stateList: [],
      // fuzhicheng: this.$t('common.fuzhicheng'),
      // fuzhishi: this.$t('common.fuzhishi'),
    }
  },
  async activated () {
    this.detail = {}
    this.typeList = await this.$getDict("user_fund_recharge_type")
    this.stateList = await this.$getDict("recharge_state")
    this.zid = this.$route.query.zid
    this.getInfo()
  },
  methods: {
    async getInfo () {
      const ret = await this.$http({
        url: `/wallet/rechargerecord/app/${this.zid}`,
        method: "get",
      })
      if (ret.data.code === 0) {
        //
        this.detail = ret.data.data
      }
    },
    toHashUrl (hash) {
      if (this.detail.publicChain == "1") {
        window.open(`https://etherscan.io/tx/${hash}`)
      } else {
        window.open(`https://tronscan.org/#/transaction/${hash}`)
      }
    },
    filterState (val) {
      return (
        this.stateList.length &&
        this.stateList.find((v) => v.value == val).description
      )
    },
    filterType (val) {
      return (
        this.typeList.length &&
        this.typeList.find((v) => v.value == val).description
      )
    },
    copyLink (val) {
      // 复制链接  val 就是你需要复制的链接
      this.$copyText(val).then(
        () => {
          this.$toast(this.$t("common.fuzhicheng"))
        },
        () => {
          this.$toast(this.$t("common.fuzhishi"))
        }
      )
    },
    goback () {
      localStorage.setItem("ls", 0)
      this.$router.go("-1")
    },
  },
};
</script>

<style scoped lang="scss">
.details {
  margin: 0;
  padding: 0;
  .top {
    width: 100vw;
    height: 11.73vw;
    background-color: #090A1B;
    color: rgba(255, 255, 255, 100);
    font-size: 4.8vw;
    //font-family: Microsoft Yahei;
    p {
      position: relative;
      bottom: 3.2vw;
    }
    img {
      position: relative;
      right: 44.8vw;
      top: 3.2vw;
      width: 5.3vw;
      height: 5.3vw;
      z-index: 100;
    }
  }
  .content {
    height: 45.86vw;
    background-color: #090A1B;
    border-bottom: 1px solid rgba(51, 53, 64, 100);
    .div1 {
      height: 9.8vw;
      p {
        position: relative;
        top: 4.26vw;
        color: rgba(135, 139, 151, 100);
        font-size: 3.73vw;
        font-family: PingFangSC-regular;
      }
    }
    .div2 {
      height: 11.2vw;
      display: flex;
      justify-content: center;
      p {
        color: rgba(255, 255, 255, 100);
        font-size: 6.4vw;
        text-align: left;
        font-family: PingFangSC-semiBold;
        position: relative;
        top: 2.13vw;
        font-weight: 600;
        span {
          color: rgba(255, 255, 255, 100);
          font-size: 3.73vw;
          font-family: PingFangSC-regular;
          position: relative;
          left: 1.06vw;
        }
      }
    }
    .div3 {
      height: 8.26vw;
      display: flex;
      justify-content: center;
      p {
        position: relative;
        top: 2.66vw;
        color: rgba(94, 186, 137, 100);
        font-size: 3.73vw;
        font-family: PingFangSC-regular;
        img {
          position: relative;
          right: 2.13vw;
          top: 0.96vw;
          height: 4.26vw;
          width: 4.26vw;
        }
      }
    }
    .div4 {
      height: 8.8vw;
      display: flex;
      justify-content: center;
      p {
        position: relative;
        width: 92vw;
        line-height: 4vw;
        top: 4.8vw;
        font-size: 3.2vw;
        font-family: PingFangSC-regular;
        color: rgba(135, 139, 151, 100);
        letter-spacing: 0.2vw;
      }
    }
  }
  .bottom {
    height: 158vw;
    background-color: #090A1B;
    .bottoma {
      height: 8.8vw;
      display: flex;
      justify-content: space-between;
      padding: 0 4.26vw;
      p {
        font-size: 3.2vw;
        position: relative;
        top: 4.26vw;
        font-family: PingFangSC-regular;
      }
      .p1 {
        color: rgba(135, 139, 151, 100);
        letter-spacing: 0.2vw;
      }
      .p2 {
        color: rgba(214, 214, 214, 100);
        letter-spacing: 0.2vw;
        font-weight: 600;
      }
    }
    .bottomb {
      height: 13.86vw;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 4.26vw;
      margin-top: 3vw;
      .p1 {
        color: rgba(135, 139, 151, 100);
        font-size: 3.2vw;
        letter-spacing: 0.2vw;
      }
      .p2 {
        width: 55.73vw;
        color: rgba(214, 214, 214, 100);
        margin-left: 11vw;
        font-size: 3.2vw;
        word-wrap: break-word;
        text-align: right;
        line-height: 5.33vw;
        letter-spacing: 0.2vw;
        font-weight: 600;
        position: absolute;
        right: 11vw;
      }
      img {
        width: 4.8vw;
        height: 4.8vw;
      }
    }
    .bottomc {
      height: 20.86vw;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 4.26vw;
      margin-top: 2.93vw;
      position: relative;
      .p1 {
        color: rgba(135, 139, 151, 100);
        font-size: 3.2vw;
        letter-spacing: 0.2vw;
      }
      .p2 {
        width: 55.73vw;
        height: 10.4vw;
        color: rgba(214, 214, 214, 100);
        font-size: 3.2vw;
        word-wrap: break-word;
        text-align: right;
        line-height: 5.3vw;
        position: absolute;
        right: 11vw;
        letter-spacing: 0.2vw;
      }
      img {
        width: 4.8vw;
        height: 4.8vw;
      }
    }
  }
}
</style>